Stereo camera apparatuses that measure the distance to a subject using a plurality of cameras are being used in vehicles.
Methods are known for detecting a three-dimensional object and measuring distance with a stereo camera by calculating the parallax at each position on the image (for example, see patent literature (PTL) 1). In such methods, a benchmark image (first image) and a reference image (second image) are captured by a stereo camera. The second image is divided into multiple blocks (small areas) measuring approximately three to nine pixels in each of the horizontal and vertical directions. Each block of the divided second image is sequentially shifted in a baseline length direction (a direction spanning the distance between the optical axes of the two cameras in the stereo camera) at a uniform pitch (for example, one pixel at a time) relative to the first image. Matching with the first image is performed on the block of the second image at each shift. Matching is performed by comparing the luminance or color pattern of the pixels in the block of the second image with the corresponding pixels in the first image. For example, when matching by luminance, the sum of the absolute value of the difference in luminance between corresponding pixels is calculated, and the shift amount that minimizes the sum is determined to be the parallax. This matching process can be executed by a dedicated hardware circuit. Using the principle of triangulation, the distance Z to an object of detection imaged in a block can be calculated with the following equation, where d is the parallax obtained in the above way, b is the baseline length of the two cameras, and f is the focal length of the cameras.Z=b·f/d  (1)
The parallax decreases at long distances and increases at short distances. At long distances, the change in parallax is small relative to a change in distance. At short distances, the change in parallax is large relative to a change in distance. Therefore, the blocks of the second image need to be shifted repeatedly on the first image during image matching between the first image and the second image at short distances. Accordingly, if parallax calculation for a target at an extremely short distance is to be accommodated, the amount of calculation and the processing time increase. Typically, a short distance measurement limit is therefore set to ensure the processing capability of the apparatus, and parallax measurement is not possible at closer positions.
Therefore, the stereo camera apparatus disclosed in PTL 1 includes a determining means for determining whether a three-dimensional object exists closer than the distance of the detectable measurement limit by using the detection result for three-dimensional objects in the previous frame. In other words, the stereo camera apparatus disclosed in PTL 1 determines that a three-dimensional object is likely to be positioned at a shorter distance than the measurement limit when a three-dimensional object that was positioned at the short distance measurement limit in the immediately prior measurement is no longer detected in the current measurement. In this case, the stereo camera apparatus extracts a characteristic portion, for example a portion with a large change in luminance, and uses a software program provided for short distance measurement to perform matching of the first image and the second image apart from the regular matching of the first image and the second image. In this manner, the stereo camera apparatus detects the distance up to a three-dimensional object.